<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:action="http://www.w3.org/1999/xhtml">
<head>


	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>首页</title>
	<link rel="stylesheet" href="../static/css/main.css" type="text/css" />
	<!-- 导入首页轮播图css和js脚本 -->
	<link type="text/css" href="../static/css/autoplay.css" rel="stylesheet" />
	<script type="text/javascript" src="../static/js/autoplay.js"></script>
	<meta charset="UTF-8">
	<title>书城首页</title>
	<link type="text/css" rel="stylesheet" th:href="@{../static/css/style.css}" >
	<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
	<script>

		$(function () {



			$(".add_cart_btn").click(function () {
				let addCartId=$(this).attr("addCartId");
				$.ajax({
							url:"/addCart",
							type:"get",
							data:{
								"bookId":addCartId
							},
							success:function (data) {
								console.log(data)
								if (!data.flag){
									location.href="/login.html"
								}
								else {
									$("#addMsg").text(data.msg)
									$("#add_cart_msg").css("display","block")
								}
							}

						}

				)
			})



		})



	</script>
</head>



<body class="main">

<div id="divhead">
	<table cellspacing="0" class="headtable">
		<tr>
			<td>
				<a href="#">
					<img src="../static/images/logo.png" width="200" height="60" border="0" />
				</a>
			</td>


			<td style="text-align:right">
				<img src="../static/images/cart.gif" width="26" height="23" style="margin-bottom:-4px" />&nbsp;<a href="#">购物车</a>
				| <a href="#">帮助中心</a>
				| <a href="#">我的帐户</a>

				<th:block th:if="${session.user==null}">
					|<a th:href="@{/book/login}">登录</a>
					|<a th:href="@{/book/register}">注册</a>
				</th:block>
				<th:block th:if="${session.user!=null}">
					<span>欢迎<span class="um_span" th:text="${session.user.username}"></span>光临书城</span>
					|<a th:href="@{/order}">我的订单</a>
					|<a th:href="@{/loginClose}">注销</a>&nbsp;&nbsp;
				</th:block>
			</td>





		</tr>
	</table>
</div>

<div id="divmenu">
	<a href="index?category=文学">文学</a>
	<a href="index?category=生活">生活</a>
	<a href="index?category=计算机">计算机</a>
	<a href="index?category=外语">外语</a>
	<a href="index?category=经管">经管</a>
	<a href="index?category=励志">励志</a>
	<a href="index?category=社科">社科</a>
	<a href="index?category=学术">学术</a>
	<a href="index?category=少儿">少儿</a>
	<a href="index?category=艺术">艺术</a>
	<a href="index?category=原版">原版</a>
	<a href="index?category=科技">科技</a>
	<a href="index?category=考试">考试</a>
	<a href="index?category=生活百科">生活百科</a>
	<a href="index?category=" style="color:#FFFF00">全部商品目录</a>
</div>

<div id="divsearch">
	<form action="#" id="searchform">
		<table width="100%" border="0" cellspacing="0">
			<tr>
				<td style="text-align:right; padding-right:220px">
					Search
					<input type="text" name="textfield" class="inputtable" id="textfield" value="请输入书名"
						   onmouseover="this.focus();"
						   onclick="my_click(this, 'textfield');"
						   onBlur="my_blur(this, 'textfield');"/>
					<a href="#">
						<img src="../static/images/serchbutton.gif" border="0" style="margin-bottom:-4px" onclick="search()"/>
					</a>
				</td>
			</tr>
		</table>
	</form>
</div>

<div id="main">

	<div th:if="${username_order}!=null">

	<table>
		<tr>
			<td>订单号</td>
			<td>接收地址</td>
			<td>接收人</td>
			<td>联系电话</td>
			<td>订单时间</td>
			<td>金额</td>
		</tr>

		<tr th:each="book:${username_order}">
			<td th:text="${book.id}"> </td>
			<td th:text="${book.receiverAddress}"> </td>
			<td th:text="${book.receiverName}"> </td>
			<td th:text="${book.receiverPhone}"> </td>
			<td th:text="${book.ordertime}"> </td>
			<td th:text="${book.money}"> </td>
		</tr>

	</table>


	</div>

</div>


<div id="divfoot">
	<table width="100%" border="0" cellspacing="0" >
		<tr>
			<td rowspan="2" style="width:10%">
				<img src="../static/images/logo.png" width="195" height="50"
					 style="margin-left:175px" />
			</td>
			<td style="padding-top:5px; padding-left:50px">
				<a href="#">
					<font color="#747556"><b>CONTACT US</b></font>
				</a>
			</td>
		</tr>
		<tr>
			<td style="padding-left:50px">
				<font color="#CCCCCC">
					<b>COPYRIGHT 2015 &copy; BookStore All Rights RESERVED.</b>
				</font>
			</td>
		</tr>
	</table>
</div>
<!-- 网上书城底部  end -->


</body>
</html>








